package logic

import (
	"context"
	"house_srv/house"

	"api/internal/svc"
	"api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserExamineLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewUserExamineLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserExamineLogic {
	return &UserExamineLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *UserExamineLogic) UserExamine(req *types.UserExamineRequest) (resp *types.Response, err error) {
	// todo: 用户管理员审核
	_, err = l.svcCtx.HouseSrv.UserExamine(l.ctx, &house.UserExamineRequest{
		RealName: req.RealName,
		IDCord:   req.IDCord,
		Front:    req.Front,
		Back:     req.Back,
	})
	if err != nil {
		return &types.Response{
			Code:    500,
			Message: err.Error(),
			Data:    nil,
		}, nil
	}
	return &types.Response{
		Code:    200,
		Message: "用户审核成功",
		Data:    nil,
	}, nil
}
